<?php namespace App\Models\Power;

use App\Models\Base\PowerBase;
use App\Models\Power\Pile;

class Good extends PowerBase {

    protected $table = 'cdz_goods';

    protected $fillable = [];

    protected $dates = [];

    public static $rules = [
        // Validation rules
    ];

    /**
     * 查询销售电桩
     */
    public function getGoods() {

        $query = self::query();
        $query -> where('status', '=', 1);

        $data = $query -> get(['name', 'price', 'first_img', 'images', 'remark']) -> toArray();

        return $data;
        
    }

    public function scopeWhereStatusNotIn($query) {

        return $query -> whereNotIn('status', [6,7]);

    }

    /**
     * 和User模型的多对一关联
     */
    // public function pile() {
    //     return $this->belongsTo('App\Models\Pile', 'pile_id');
    // }



}
